package com.huawei.hms.support.api.pay.json;

import android.app.PendingIntent;
import android.os.Parcelable;
import com.huawei.hms.common.ApiException;
import com.huawei.hms.common.internal.ResponseErrorCode;
import com.huawei.hms.common.internal.TaskApiCall;
import com.huawei.hms.support.api.client.Status;
import com.huawei.hms.support.api.entity.pay.WalletIntentResp;
import com.huawei.hms.support.api.pay.GetWalletUiIntentResult;
import com.huawei.hms.support.log.HMSLog;
import com.huawei.hms.utils.JsonUtil;
import o.fjx;

public class GetWalletUiIntentTaskApiCall extends TaskApiCall<PayHmsClient, GetWalletUiIntentResult> {
    public GetWalletUiIntentTaskApiCall(String str, String str2) {
        super(str, str2);
    }

    protected void doExecute(PayHmsClient payHmsClient, ResponseErrorCode responseErrorCode, String str, fjx<GetWalletUiIntentResult> o_fjx_com_huawei_hms_support_api_pay_GetWalletUiIntentResult) {
        if (responseErrorCode == null) {
            o_fjx_com_huawei_hms_support_api_pay_GetWalletUiIntentResult.ॱ(new ApiException(new Status(1)));
        } else if (responseErrorCode.getErrorCode() == 0) {
            HMSLog.i("GetWalletUiIntentTaskApiCall", "onResult, success");
            JsonUtil.jsonToEntity(str, new WalletIntentResp());
            GetWalletUiIntentResult getWalletUiIntentResult = new GetWalletUiIntentResult();
            Parcelable parcelable = responseErrorCode.getParcelable();
            if (parcelable instanceof PendingIntent) {
                getWalletUiIntentResult.setStatus(new Status(responseErrorCode.getStatusCode(), responseErrorCode.getErrorReason(), (PendingIntent) parcelable));
                getWalletUiIntentResult.setPendingIntent((PendingIntent) parcelable);
                o_fjx_com_huawei_hms_support_api_pay_GetWalletUiIntentResult.ॱ(getWalletUiIntentResult);
                return;
            }
            o_fjx_com_huawei_hms_support_api_pay_GetWalletUiIntentResult.ॱ(new ApiException(new Status(responseErrorCode.getStatusCode(), responseErrorCode.getErrorReason())));
        } else {
            HMSLog.i("GetWalletUiIntentTaskApiCall", "onResult, returnCode: " + responseErrorCode.getErrorCode());
            o_fjx_com_huawei_hms_support_api_pay_GetWalletUiIntentResult.ॱ(new ApiException(new Status(responseErrorCode.getErrorCode(), responseErrorCode.getErrorReason())));
        }
    }
}
